// package com.jungle.sp.daily.controller;
//
//
// import com.google.firebase.auth.FirebaseAuth;
//
// import java.util.concurrent.TimeUnit;
//
// public class FirebasePhoneAuth {
//
//     // 发送短信验证码
//     public static void sendVerificationCode(String phoneNumber) {
//         PhoneAuthOptions options = PhoneAuthOptions.newBuilder(FirebaseAuth.getInstance())
//             .setPhoneNumber(phoneNumber)          // 用户的电话号码
//             .setTimeout(60L, TimeUnit.SECONDS)    // 验证码有效时间
//             .setActivity(yourActivity)            // 传入当前的 Activity 对象
//             .setCallbacks(new PhoneAuthProvider.OnVerificationStateChangedCallbacks() {
//                 @Override
//                 public void onVerificationCompleted(PhoneAuthCredential phoneAuthCredential) {
//                     // 自动验证完成后的处理
//                     System.out.println("Verification completed successfully.");
//                 }
//
//                 @Override
//                 public void onVerificationFailed(Exception e) {
//                     // 验证失败时的处理
//                     System.out.println("Verification failed: " + e.getMessage());
//                 }
//
//                 @Override
//                 public void onCodeSent(String verificationId, PhoneAuthProvider.ForceResendingToken token) {
//                     // 验证码发送成功时的回调
//                     System.out.println("Verification code sent.");
//                 }
//             })
//             .build();
//
//         PhoneAuthProvider.verifyPhoneNumber(options);
//     }
//
//     // 验证短信验证码
//     public static void verifyCode(String verificationId, String code) {
//         PhoneAuthCredential credential = PhoneAuthProvider.getCredential(verificationId, code);
//
//         FirebaseAuth.getInstance().signInWithCredential(credential)
//             .addOnCompleteListener(task -> {
//                 if (task.isSuccessful()) {
//                     // 验证成功
//                     System.out.println("Phone verification successful.");
//                 } else {
//                     // 验证失败
//                     System.out.println("Phone verification failed: " + task.getException().getMessage());
//                 }
//             });
//     }
// }
